//
//  SurpriseSubDatasModel.swift
//  XiaoJingMallSwift
//
//  Created by beisheng03 on 2017/8/12.
//  Copyright © 2017年 beisheng. All rights reserved.
//

import UIKit

class SurpriseSubDatasModel: NSObject {
    
    var list = [SupriseDataListModel]()
    
    init(dic : [String : AnyObject]) {
        super.init()
        
        setValuesForKeys(dic)
        
    }
    
    
    override func  setValue(_ value: Any?, forKey key: String) {
        
        if key == "list" {
            
            if let temp = value as? [[String : AnyObject]]{
                
                for dic in temp {
                    
                    list.append(SupriseDataListModel(dic:dic ))
                }
                
                
            }
            
            
        } else {
            
            
            super.setValue(value, forKey: key)
        }
        
    }
    
    override func setValue(_ value: Any?, forUndefinedKey key: String) {
        
        
    }
    
    
    //在swift中想要打印对象要以下重写属性
    override var description: String{
        let keys = ["list"]
        let dic = dictionaryWithValues(forKeys: keys)
        return "\(dic)"
    }


}
